<script>
init({
  title: 'Issue #383',
  desc: 'Use Flat UI to style the checkboxes(<a href="https://github.com/wenzhixin/bootstrap-table/issues/383" target="_blank">#383</a>.)',
  links: [
    'https://cdnjs.cloudflare.com/ajax/libs/flat-ui/2.3.0/css/flat-ui.min.css',
    'bootstrap-table.min.css'
  ],
  scripts: [
    'https://cdnjs.cloudflare.com/ajax/libs/flat-ui/2.3.0/js/flat-ui.min.js',
    'bootstrap-table.min.js'
  ]
})
</script>

<script>
  const $table = $('#table')

  function mounted () {
    $table.on('post-body.bs.table', function () {
      $(':checkbox').each(function () {
        if (!$(this).parent().hasClass('checkbox')) {
          $(this).wrap('<label class="checkbox"></label>').radiocheck()
        }
      })
      $('.dropdown-toggle').dropdown()
    })
  }
</script>

<template>
  <table
    id="table"
    data-toggle="table"
    data-pagination="true"
    data-url="json/data1.json"
  >
    <thead>
      <tr>
        <th
          data-field="state"
          data-checkbox="true"
        ></th>
        <th data-field="id">
          ID
        </th>
        <th data-field="name">
          Item Name
        </th>
        <th data-field="price">
          Item Price
        </th>
      </tr>
    </thead>
  </table>
</template>

<style>
  .checkbox {
    padding-left: 22px;
    margin-bottom: 16px;
  }
  .caret {
    display: none;
  }
  .pull-left {
    float: left;
  }
  .pull-right {
    float: right;
  }
  .bootstrap-table .fixed-table-pagination > .pagination ul.pagination a {
    padding: 12px 10px;
  }
  .page-item.active .page-link {
    background-color: #1abc9c;
    border: none;
  }
</style>
